package dw2;
import java.awt.*;
import java.util.Random;

public class Scenery
{
    private int x,y;
    private DWGraphics graphics;
    private Random random = new Random();

    public Scenery(Image tempimage,int x, int y)
    {
      graphics = new DWGraphics(tempimage);
      this.x = x;
      this.y = y;
    }

    public void draw(Graphics g,Main mainparent)
    {
        int shakeamount = mainparent.getShakeAmount();
        int move = mainparent.getSize().width/2;
        move -= mainparent.getScroll();
        int ymove = 0;
        if(mainparent.isShaking())
        {
            move += (random.nextInt(shakeamount*2)-shakeamount);
            ymove = (random.nextInt(shakeamount*2)-shakeamount);
        }

        graphics.draw(g,move+x, ymove+y, 0, 0);

    }
}